package com.xxx.dict.service.impl;

import com.github.pagehelper.PageHelper;

import com.xxx.dict.domain.Dict;
import com.xxx.dict.mapper.DictMapper;
import com.xxx.dict.query.DictQuery;
import com.xxx.dict.service.IDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictServiceImpl implements IDictService {
    @Autowired
    private DictMapper dictMapper;

    @Override
    public List<Dict> findAll() {
        List<Dict> list = dictMapper.findAll();
        return list;
    }

    @Override
    public Dict findOne(Long id) {
        return dictMapper.findOne(id);
    }

    @Override
    public List<Dict> findByPage(DictQuery dictQuery) {
        PageHelper.startPage(dictQuery.getCurrentPage(), dictQuery.getPageSize());
        return dictMapper.findByPage(dictQuery);
    }

    @Override
    public void updateById(Dict dict) {
        dictMapper.updateById(dict);
    }

    @Override
    public void insert(Dict dict) {

        dictMapper.insert(dict);

    }

    @Override
    public void deleteById(Long id) {
        dictMapper.deleteById(id);
    }

    @Override
    public void bathDicts(Long[] ids) {
        dictMapper.bathDicts(ids);
    }
}
